Completed
Pull Request — master (#1653)
by Aristeides
04:16 queued 02:06
created

rol.extend.initKirkiControl   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 21
rs 9.3142
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A 0 15 1
1
wp.customize.controlConstructor['kirki-multicheck'] = wp.customize.kirkiDynamicControl.extend({
2
3
	initKirkiControl: function() {
4
5
		var control = this;
0 ignored issues
show
Coding Style introduced by
As per coding-style, prefer block-scoped variables using let or const which have better semantics than var.

Since ECMAScript 6, you can create block-scoped vars or constants with the keywords let or const. These variables/constants are only valid in the code block where they have been declared.

Consider the following two pieces of code:

if (true)
 {
    var x = "Hello, Stonehenge!";
}

console.log(x); //prints Hello, Stonehenge! to the console

and

if (true)
 {
    let x = "Hello, Stonehenge!";
}

console.log(x); //ReferenceError: x is not defined

The variable is not defined otuside of its block. This limits bleeding of variables into other contexts.

To know more about this ECMA6 feature, look at the MDN pages on let and const.

Loading history...
6
7
		// Save the value
8
		control.container.on( 'change', 'input', function() {
9
			var value = [],
0 ignored issues
show
Coding Style introduced by
As per coding-style, prefer block-scoped variables using let or const which have better semantics than var.

Since ECMAScript 6, you can create block-scoped vars or constants with the keywords let or const. These variables/constants are only valid in the code block where they have been declared.

Consider the following two pieces of code:

if (true)
 {
    var x = "Hello, Stonehenge!";
}

console.log(x); //prints Hello, Stonehenge! to the console

and

if (true)
 {
    let x = "Hello, Stonehenge!";
}

console.log(x); //ReferenceError: x is not defined

The variable is not defined otuside of its block. This limits bleeding of variables into other contexts.

To know more about this ECMA6 feature, look at the MDN pages on let and const.

Loading history...
10
			    i = 0;
11
12
			// Build the value as an object using the sub-values from individual checkboxes.
13
			jQuery.each( control.params.choices, function( key ) {
14
				if ( control.container.find( 'input[value="' + key + '"]' ).is( ':checked' ) ) {
15
					value[ i ] = key;
16
					i++;
17
				}
18
			});
19
20
			// Update the value in the customizer.
21
			control.setting.set( value );
22
		});
23
	}
24
});
25